﻿function addfavorite(){
   switch(getOs()){
       case 1:window.external.addFavorite('http://www.lotopop.com','Lotopop型站分享网');break;
       case 2:window.sidebar.addPanel('Lotopop型站分享网', 'http://www.lotopop.com', "");break;
       case 0:alert("该操作被浏览器拒绝, 请按 cril+D  收藏本页, 或通过浏览器菜单收藏, 感谢支持");break;
   }
}
function getOs(){
   if(navigator.userAgent.indexOf("MSIE")>0)return 1;
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0)return 2;
   if(isSafari=navigator.userAgent.indexOf("Safari")>0)return 3;   
   if(isCamino=navigator.userAgent.indexOf("Camino")>0)return 4;
   if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0)return 5;
   if(navigator.userAgent.indexOf('Opera') >= 0)return 1;
   return 0;
}


function detectBrowser(){//Writed by zhong1806#gmail.com at 2007-8-9 15:14:25
	var sAgent = navigator.userAgent.toLowerCase();
	this.isIE = (sAgent.indexOf("msie")!=-1); //IE6.0-7
	this.isFF = (sAgent.indexOf("firefox")!=-1);//firefox
	this.isSa = (sAgent.indexOf("safari")!=-1);//safari
	this.isOp = (sAgent.indexOf("opera")!=-1);//opera
	this.isNN = (sAgent.indexOf("netscape")!=-1);//netscape
	this.isMa = this.isIE;//marthon
	this.isOther = (!this.isIE && !this.isFF && !this.isSa && !this.isOp && !this.isNN && !this.isSa);//unknown Browser
}
var oBrowser = new detectBrowser();




function setHomepage(url){
	if (document.all){
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage(url);
	}else if (window.sidebar){
		if(window.netscape){
			 try{  
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
			 }catch(e){  
				alert( "该操作被浏览器拒绝, 请手动设置首页, 感谢支持" );  
			 }
		} 
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
		prefs.setCharPref('browser.startup.homepage','http://www.carzymusic.com');
	}
}